from django.contrib import admin
from .models import ProcessTemplate, UserProcess, ProcessDocument


@admin.register(ProcessTemplate)
class ProcessTemplateAdmin(admin.ModelAdmin):
    list_display = ['name', 'category', 'estimated_days', 'created_at']
    list_filter = ['category', 'created_at']
    search_fields = ['name', 'description']
    ordering = ['category', 'name']


@admin.register(UserProcess)
class UserProcessAdmin(admin.ModelAdmin):
    list_display = ['user_profile', 'template', 'status', 'current_step', 'started_at', 'completed_at']
    list_filter = ['status', 'template__category', 'created_at']
    search_fields = ['user_profile__user__username', 'template__name']
    list_editable = ['status']
    ordering = ['-created_at']


@admin.register(ProcessDocument)
class ProcessDocumentAdmin(admin.ModelAdmin):
    list_display = ['document_name', 'user_process', 'document_type', 'status', 'uploaded_at']
    list_filter = ['status', 'document_type', 'created_at']
    search_fields = ['document_name', 'user_process__template__name']
    list_editable = ['status']
    ordering = ['-created_at']
